<?php

namespace app\model;

class Salesman extends SalesmanBase
{
    protected $type = [
        'invoice_tax' => 'float',
    ];

    public function company()
    {
        return $this->belongsTo(Company::class, "company_id", "id");
    }

    public static function onBeforeWrite($user)
    {
        if (!empty($user->phone)) {
            $user->token = md5($user->phone);
        }
    }
}
